using NUnit.Framework;
using SQLRunnerLib.DB;
using SQLTests.Framework;

namespace SQLTests.Lib.DB
{
	/// <summary>
	/// Summary description for SQLUtilTests.
	/// </summary>
	public class SQLUtilTests:
		AbstractTest
	{
		public SQLUtilTests():base(){}

		[Test]
		public void DetermineApp()
		{
			
			Assert.AreEqual(
				_util.SqlApplicationFactory((int)SQLUtil.SQLApp.QueryAnalyzer),
				"isqlw.exe");

			Assert.AreEqual(
				_util.SqlApplicationFactory((int)SQLUtil.SQLApp.Sqlwb),
				"sqlwb.exe");

		}

		[Test]
		public void QueryAnalizerArgs()
		{
			Assert.AreEqual(
				_util.SqlArgumentFactory((int)SQLUtil.SQLApp.QueryAnalyzer,
				_args),
				"-f\"fileName\" -SSQLServer -dSQLDatabase -E");
		}

		[Test]
		public void ManagerStudioArgs()
		{
			Assert.AreEqual(
				_util.SqlArgumentFactory((int)SQLUtil.SQLApp.Sqlwb,
				_args),
				"\"fileName\" -S SQLServer -d SQLDatabase -E -nosplash");
			
		}
		#region fixtures
		
		private SQLArguments _args;
		private SQLUtil _util;

		[TestFixtureSetUp]
		protected override void SetUpFixtures()
		{
			_args = new SQLArguments(
				"SQLServer",
				"SQLDatabase",
				"userName",
				"userPwd",
				true,
				"fileName");
			_util = new SQLUtil();
		}

		#endregion
	}
}
